---------------------------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  /Users/wesleyblundell/Dropbox/Wes_Supplemental_NEI/JAERE_Replication/Replication_package/log/Table_8_Results.log
  log type:  text
 opened on:  15 May 2024, 11:31:41

. eststo clear

. use "$rootpath/processed_data/Estimation_Data.dta", clear

. 
. sort naics 

. gen log_all=asinh(All/1000)

. egen industry_mean_dam=mean(log_all), by(naics)

. 
. gen avg_old_code_probwh=avg_old_code_prob*(log_all/(industry_mean_dam+1)) 

. egen industry_mean=mean(avg_old_code_probwh), by(naics year)

. 
. gen treat_diff=(treatXpost - industry_mean)*post

. 
. gen treat_diffXtreatXpost = treatXpost*treat_diff

. 
. sort facility_id year

. egen num_obs2=nvals(year), by(facility_id)

. //facility-level se
. reghdfe  log_damage55  treat_diffXtreatXpost treatXpost treat_diff if key_estimation_sample==1&naics>300000&naics<400000, absorb(facility_id n5#c.year)
>  vce(cluster facility_id)
(dropped 19 singleton observations)
(MWFE estimator converged in 169 iterations)

HDFE Linear regression                            Number of obs   =    173,752
Absorbing 2 HDFE groups                           F(   3,  20259) =      49.75
Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                  R-squared       =     0.9250
                                                  Adj R-squared   =     0.9150
                                                  Within R-sq.    =     0.0023
Number of clusters (facility_id) =     20,260     Root MSE        =     0.4839

                                (Std. Err. adjusted for 20,260 clusters in facility_id)
---------------------------------------------------------------------------------------
                      |               Robust
         log_damage55 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
----------------------+----------------------------------------------------------------
treat_diffXtreatXpost |   .0367598   .0636982     0.58   0.564    -.0880938    .1616134
           treatXpost |  -.2661865   .0333384    -7.98   0.000    -.3315326   -.2008405
           treat_diff |    .089517    .040135     2.23   0.026     .0108491    .1681849
                _cons |   1.532383   .0029377   521.63   0.000     1.526625    1.538141
---------------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
 facility_id |     20260       20260           0    *|
   n5#c.year |       179           0         179    ?|
-----------------------------------------------------+
? = number of redundant parameters may be higher
* = FE nested within cluster; treated as redundant for DoF computation

. estimates store ddd_1_damage

. 
. //state-level se
. reghdfe  log_damage55  treat_diffXtreatXpost treatXpost treat_diff if key_estimation_sample==1&naics>300000&naics<400000, absorb(facility_id n5#c.year)
>  vce(cluster state_number)
(dropped 19 singleton observations)
(MWFE estimator converged in 169 iterations)

HDFE Linear regression                            Number of obs   =    173,752
Absorbing 2 HDFE groups                           F(   3,     46) =       9.57
Statistics robust to heteroskedasticity           Prob > F        =     0.0001
                                                  R-squared       =     0.9250
                                                  Adj R-squared   =     0.9150
                                                  Within R-sq.    =     0.0023
Number of clusters (state_number) =         47    Root MSE        =     0.4839

                                   (Std. Err. adjusted for 47 clusters in state_number)
---------------------------------------------------------------------------------------
                      |               Robust
         log_damage55 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
----------------------+----------------------------------------------------------------
treat_diffXtreatXpost |   .0367598   .1761387     0.21   0.836    -.3177891    .3913087
           treatXpost |  -.2661865   .0643639    -4.14   0.000    -.3957444   -.1366287
           treat_diff |    .089517   .0489973     1.83   0.074    -.0091095    .1881435
                _cons |   1.532383   .0064511   237.54   0.000     1.519398    1.545368
---------------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
 facility_id |     20260       20260           0    *|
   n5#c.year |       179           0         179    ?|
-----------------------------------------------------+
? = number of redundant parameters may be higher
* = FE nested within cluster; treated as redundant for DoF computation

. estimates store ddd_1_damageSE

. //facility-level se
. reghdfe  log_emissions4  treat_diffXtreatXpost treatXpost treat_diff if key_estimation_sample==1&naics>300000&naics<400000, absorb(facility_id n5#c.yea
> r) vce(cluster facility_id)
(dropped 19 singleton observations)
(MWFE estimator converged in 169 iterations)

HDFE Linear regression                            Number of obs   =    173,752
Absorbing 2 HDFE groups                           F(   3,  20259) =     110.78
Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                  R-squared       =     0.9258
                                                  Adj R-squared   =     0.9159
                                                  Within R-sq.    =     0.0045
Number of clusters (facility_id) =     20,260     Root MSE        =     0.4149

                                (Std. Err. adjusted for 20,260 clusters in facility_id)
---------------------------------------------------------------------------------------
                      |               Robust
       log_emissions4 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
----------------------+----------------------------------------------------------------
treat_diffXtreatXpost |   .0207429   .0577936     0.36   0.720    -.0925373    .1340231
           treatXpost |  -.2338443   .0257934    -9.07   0.000    -.2844015   -.1832871
           treat_diff |   .0097851   .0341994     0.29   0.775    -.0572485    .0768187
                _cons |   1.207933   .0024068   501.88   0.000     1.203215     1.21265
---------------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
 facility_id |     20260       20260           0    *|
   n5#c.year |       179           0         179    ?|
-----------------------------------------------------+
? = number of redundant parameters may be higher
* = FE nested within cluster; treated as redundant for DoF computation

. estimates store ddd_1_emission

. 
. //state-level se
. reghdfe  log_emissions4  treat_diffXtreatXpost treatXpost treat_diff if key_estimation_sample==1&naics>300000&naics<400000, absorb(facility_id n5#c.yea
> r) vce(cluster state_number)
(dropped 19 singleton observations)
(MWFE estimator converged in 169 iterations)

HDFE Linear regression                            Number of obs   =    173,752
Absorbing 2 HDFE groups                           F(   3,     46) =      11.80
Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                  R-squared       =     0.9258
                                                  Adj R-squared   =     0.9159
                                                  Within R-sq.    =     0.0045
Number of clusters (state_number) =         47    Root MSE        =     0.4149

                                   (Std. Err. adjusted for 47 clusters in state_number)
---------------------------------------------------------------------------------------
                      |               Robust
       log_emissions4 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
----------------------+----------------------------------------------------------------
treat_diffXtreatXpost |   .0207429   .2767606     0.07   0.941    -.5363473     .577833
           treatXpost |  -.2338443   .0628559    -3.72   0.001    -.3603666   -.1073219
           treat_diff |   .0097851   .1072079     0.09   0.928    -.2060132    .2255835
                _cons |   1.207933   .0066124   182.68   0.000     1.194623    1.221243
---------------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
 facility_id |     20260       20260           0    *|
   n5#c.year |       179           0         179    ?|
-----------------------------------------------------+
? = number of redundant parameters may be higher
* = FE nested within cluster; treated as redundant for DoF computation

. estimates store ddd_1_emissionSE

. 
. use"$rootpath/processed_data/Estimation_Data.dta", clear

. gen temp_id=facility_id if watch_list==1
(966,584 missing values generated)

. sort state

. egen state_wls=nvals(temp_id), by(state)
(966584 missing values generated)

. egen count_state_wls=max(state_wls), by(state)
(4117 missing values generated)

. replace count_state_wls=0 if count_state_wls==.
(4,117 real changes made)

. drop temp_id

. gen temp_id=facility_id if post==0
(377,938 missing values generated)

. sort state

. egen state_plant_count=nvals(temp_id), by(state)
(377938 missing values generated)

. egen count_state_plants=max(state_plant_count), by(state)

.   
. gen treat_diff=(count_state_wls/count_state_plants)*post

. 
. gen treat_diffXtreatXpost = treatXpost*treat_diff

. 
. //Note that clustering at state_number#naics is interesting. 
. //facility-level se
. reghdfe  log_damage55  treat_diffXtreatXpost treatXpost treat_diff if key_estimation_sample==1, absorb(facility_id n5#year) vce(cluster facility_id)
(MWFE estimator converged in 245 iterations)

HDFE Linear regression                            Number of obs   =    699,013
Absorbing 2 HDFE groups                           F(   3,  81431) =      34.50
Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                  R-squared       =     0.9406
                                                  Adj R-squared   =     0.9321
                                                  Within R-sq.    =     0.0007
Number of clusters (facility_id) =     81,432     Root MSE        =     0.3624

                                (Std. Err. adjusted for 81,432 clusters in facility_id)
---------------------------------------------------------------------------------------
                      |               Robust
         log_damage55 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
----------------------+----------------------------------------------------------------
treat_diffXtreatXpost |   .0074888   1.866566     0.00   0.997    -3.650968    3.665945
           treatXpost |  -.0476506   .0178805    -2.66   0.008    -.0826962    -.012605
           treat_diff |  -2.226722   .8651292    -2.57   0.010    -3.922369   -.5310743
                _cons |   .8710272   .0030949   281.44   0.000     .8649613    .8770932
---------------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
 facility_id |     81432       81432           0    *|
     n5#year |      6834           1        6833     |
-----------------------------------------------------+
* = FE nested within cluster; treated as redundant for DoF computation

. estimates store ddd_2_damage

. 
. //state-level se
. reghdfe  log_damage55  treat_diffXtreatXpost treatXpost treat_diff if key_estimation_sample==1, absorb(facility_id n5#year) vce(cluster state_number)
(MWFE estimator converged in 245 iterations)

HDFE Linear regression                            Number of obs   =    699,013
Absorbing 2 HDFE groups                           F(   3,     47) =       9.28
Statistics robust to heteroskedasticity           Prob > F        =     0.0001
                                                  R-squared       =     0.9406
                                                  Adj R-squared   =     0.9321
                                                  Within R-sq.    =     0.0007
Number of clusters (state_number) =         48    Root MSE        =     0.3624

                                   (Std. Err. adjusted for 48 clusters in state_number)
---------------------------------------------------------------------------------------
                      |               Robust
         log_damage55 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
----------------------+----------------------------------------------------------------
treat_diffXtreatXpost |   .0074888   4.799385     0.00   0.999    -9.647629    9.662606
           treatXpost |  -.0476506   .0578859    -0.82   0.415     -.164102    .0688008
           treat_diff |  -2.226722   2.399582    -0.93   0.358    -7.054058    2.600614
                _cons |   .8710272   .0102138    85.28   0.000     .8504796    .8915748
---------------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
 facility_id |     81432       81432           0    *|
     n5#year |      6834           1        6833     |
-----------------------------------------------------+
* = FE nested within cluster; treated as redundant for DoF computation

. estimates store ddd_2_damageSE

. ///This is emissions
> //facility-level se
. reghdfe  log_emissions4  treat_diffXtreatXpost treatXpost treat_diff if key_estimation_sample==1, absorb(facility_id n5#year) vce(cluster facility_id)
(MWFE estimator converged in 248 iterations)

HDFE Linear regression                            Number of obs   =    699,013
Absorbing 2 HDFE groups                           F(   3,  81431) =      39.53
Statistics robust to heteroskedasticity           Prob > F        =     0.0000
                                                  R-squared       =     0.9415
                                                  Adj R-squared   =     0.9331
                                                  Within R-sq.    =     0.0009
Number of clusters (facility_id) =     81,432     Root MSE        =     0.3080

                                (Std. Err. adjusted for 81,432 clusters in facility_id)
---------------------------------------------------------------------------------------
                      |               Robust
       log_emissions4 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
----------------------+----------------------------------------------------------------
treat_diffXtreatXpost |  -2.252033   1.659812    -1.36   0.175    -5.505253    1.001186
           treatXpost |  -.0297404   .0155531    -1.91   0.056    -.0602244    .0007436
           treat_diff |  -1.110054   .7439195    -1.49   0.136    -2.568131    .3480229
                _cons |   .7139588   .0026494   269.48   0.000     .7087661    .7191516
---------------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
 facility_id |     81432       81432           0    *|
     n5#year |      6834           1        6833     |
-----------------------------------------------------+
* = FE nested within cluster; treated as redundant for DoF computation

. 
. estimates store ddd_2_emission

. 
. //state-level se
. reghdfe  log_emissions4  treat_diffXtreatXpost treatXpost treat_diff if key_estimation_sample==1, absorb(facility_id n5#year) vce(cluster state_number)
(MWFE estimator converged in 248 iterations)

HDFE Linear regression                            Number of obs   =    699,013
Absorbing 2 HDFE groups                           F(   3,     47) =       3.24
Statistics robust to heteroskedasticity           Prob > F        =     0.0305
                                                  R-squared       =     0.9415
                                                  Adj R-squared   =     0.9331
                                                  Within R-sq.    =     0.0009
Number of clusters (state_number) =         48    Root MSE        =     0.3080

                                   (Std. Err. adjusted for 48 clusters in state_number)
---------------------------------------------------------------------------------------
                      |               Robust
       log_emissions4 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
----------------------+----------------------------------------------------------------
treat_diffXtreatXpost |  -2.252033   5.765853    -0.39   0.698    -13.85143    9.347367
           treatXpost |  -.0297404   .0595195    -0.50   0.620    -.1494781    .0899973
           treat_diff |  -1.110054   2.574166    -0.43   0.668    -6.288608      4.0685
                _cons |   .7139588   .0102782    69.46   0.000     .6932818    .7346359
---------------------------------------------------------------------------------------

Absorbed degrees of freedom:
-----------------------------------------------------+
 Absorbed FE | Categories  - Redundant  = Num. Coefs |
-------------+---------------------------------------|
 facility_id |     81432       81432           0    *|
     n5#year |      6834           1        6833     |
-----------------------------------------------------+
* = FE nested within cluster; treated as redundant for DoF computation

. estimates store ddd_2_emissionSE

. 
. esttab ddd_1_damage ddd_2_damage ddd_1_emission ddd_2_emission using "$rootpath/table_graph/DDD_TBL8.tex",  star( * 0.1 ** 0.05 *** 0.01) cells(b(star 
> fmt(3)) se(par fmt(3))) keep(treat_diffXtreatXpost treatXpost treat_diff _cons) scalars(N F) ar2 replace 
(note: file /Users/wesleyblundell/Dropbox/Wes_Supplemental_NEI/JAERE_Replication/Replication_package/table_graph/DDD_TBL8.tex not found)
(output written to /Users/wesleyblundell/Dropbox/Wes_Supplemental_NEI/JAERE_Replication/Replication_package/table_graph/DDD_TBL8.tex)

. esttab ddd_1_damageSE ddd_2_damageSE ddd_1_emissionSE ddd_2_emissionSE using "$rootpath/table_graph/DDD_TBL8SE.tex",  star( * 0.1 ** 0.05 *** 0.01) cel
> ls(b(star fmt(3)) se(par fmt(3))) keep(treat_diffXtreatXpost treatXpost treat_diff _cons) scalars(N F) ar2 replace 
(note: file /Users/wesleyblundell/Dropbox/Wes_Supplemental_NEI/JAERE_Replication/Replication_package/table_graph/DDD_TBL8SE.tex not found)
(output written to /Users/wesleyblundell/Dropbox/Wes_Supplemental_NEI/JAERE_Replication/Replication_package/table_graph/DDD_TBL8SE.tex)

. log close
      name:  <unnamed>
       log:  /Users/wesleyblundell/Dropbox/Wes_Supplemental_NEI/JAERE_Replication/Replication_package/log/Table_8_Results.log
  log type:  text
 closed on:  15 May 2024, 11:37:07
---------------------------------------------------------------------------------------------------------------------------------------------------------
